n,k,x= map(int,input().split())

nums=list(map(int,input().split()))
# for i in range(n):
#     nums[i]= int(nums[i])
nums.sort()
mid=0
list_s=[]
start=0
# for i in range(n):
#     if nums[i]>=x:
#         mid = nums[i]
#         start=i
#         if nums[i]-x >= x - nums[i]:
#             mid=nums[i-1]
#             start=i
#
# while k>0:


for i in range(n):
    temp = abs(nums[i]-x)
    list_s.append([temp,nums[i]])

list_s.sort(key= lambda x:(x[0],x[1]))

temp_list=list_s[0:k]
temp_list.sort(key= lambda x:x[1])
for i in range(k):
    print(temp_list[i][1],end=" ")
